#ifndef SEQIOT_CGI_HELPER_H
#define SEQIOT_CGI_HELPER_H

#include <stdio.h>
#include <cjson/cJSON.h>

#define HTTP_METHOD_GET "GET"
#define HTTP_METHOD_POST "POST"

typedef struct {
    //当前请求的Accept头信息内容
    char *http_accept;
    char *request_method;
    char *query_string;
    int content_length;
    cJSON *json;
} http_request_t;

http_request_t *http_request_new();

void http_request_free(http_request_t *ptr);

int http_request_from_args(http_request_t *request, int argc, char *argv[]);

int http_request_from_env(http_request_t *request);

int http_request_from_file(http_request_t *request, FILE *fp);

#endif //SEQIOT_CGI_HELPER_H
